#!/bin/bash
read -p "请输入对应的用户名: " user
if [ -z $user ];then
      echo "用户名不能为空"
      exit 1
fi
user1=`w|grep $user|wc -l`
if [ $user1 -gt 0 ];then
      echo "$user 已登陆"
      w|grep $user
else
      echo "此用户$user没有登陆"
      exit 1
fi
